using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;

public class use
{
    static Dictionary<string, string> userDict = new Dictionary<string, string>();

    public static void RunUserAuth()
    {
        bool isRunning = true;
        while (isRunning)
        {
            ShowMainMenu();
            string choice = Console.ReadLine();
            switch (choice)
            {
                case "1": Login(); break;
                case "2": Register(); break;
                case "3": isRunning = false; Console.WriteLine("退出用户系统，再见！"); break;
                default: Console.WriteLine("请输入有效数字（1-3），按回车继续..."); Console.ReadLine(); break;
            }
        }
    }

    static void ShowMainMenu()
    {
        Console.Clear();
        Console.WriteLine("===== 用户登录注册系统 =====");
        Console.WriteLine("1. 登录");
        Console.WriteLine("2. 注册");
        Console.WriteLine("3. 退出");
        Console.Write("请选择功能：");
    }

    static void Register()
    {
        // 用户注册的实现代码...
    }

    static void Login()
    {
        // 用户登录的实现代码...
    }

    // 补全密码、用户名验证方法
    static bool IsValidUsername(string username) => Regex.IsMatch(username, @"^[a-zA-Z0-9_]{3,15}$");
    static bool IsValidPassword(string password) => Regex.IsMatch(password, @"^(?=.*[A-Z])(?=.*[a-z])(?=.*\d).{6,20}$");
    static bool IsNotEmpty(string input) => !string.IsNullOrWhiteSpace(input);
}